public class Exercise13 {
    public String intToRoman(int num) {
        int[] nums = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
        String[] symbols = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};

        StringBuffer stringBuffer = new StringBuffer();
        for(int i = 0;i < nums.length;i++) {
            while(num >= nums[i]) {
                stringBuffer.append(symbols[i]);
                num -= nums[i];
            }
        }
        return stringBuffer.toString();
    }
}
